<?php
    include('../libary/init_admin.php');
	if (isset($_GET['idsave']))
	{
	$id=$_GET['idsave'];
	$cmd="SELECT * FROM `tmp` WHERE tmp_id=".$id;
	$info=mysql_fetch_assoc(mysql_query($cmd));
	$filepath="http://beta.cailuongso.com/".$info['tmp_link'];
	$ext=substr($info['tmp_link'],strlen($info['tmp_link'])-4,4);
	header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=".convert($info['media_name']).$ext);
    header("Content-Type: mime/type");
    header("Content-Transfer-Encoding: binary");  
    header('Content-Length: '. filesize($filepath));
    readfile($filepath);
	} else die();
?>